<{if $formtag}>
<input type="checkbox" id="flatdata_embed_formONOFF<{$basedata.item_id}>"  onclick="flatdata_onoff<{$basedata.item_id}>('flatdata_embed_form');">
<{$smarty.const._MD_FLATDATA_FORM_ONOFF}>

<div id="flatdata_embed_form<{$basedata.item_id}>" style="display:none;">
	<form action="<{$myurl}>/index.php?page=embedpost" name="postform" method="post" style="padding:2px;" >


<table border="1" style="padding:6px;border-collapse:collapse;empty-cells:show; border-color:#999;margin-bottom:16px;">
	<tr> 
		<th nowrap="nowrap" colspan="2"> 
			<{if $data && !$post_multi}><{$smarty.const._MD_FD_EDIT_DATA}><{else}><{$smarty.const._MD_FD_SUBMIT_DATA}><{/if}>
		</th>
	</tr>
<{/if}>

<{* <!---- If you use the XCAT's category, delete comment out. It is necessary to be installed XCAT. ---->
  <{if $cattree}>
    <tr>
      <td class="head" nowrap="nowrap">
        <{$smarty.const._MD_FD_CATEGORY}>
      </td>
      <td class="<{cycle values='odd,even'}>" >
        <select name="cat_id">
        <option value="0"><{$smarty.const._MD_FD_NO_CATEGORY}></option>
        <{xcatsvc_catselect tree=$cattree selectedValue=$data[0].cat_id}>
        </select>
      </td>
    </tr>
  <{/if}>
*}>

	<{foreach item=f from=$fields key=count name=i}>
		<{if $f.visible==1}>
		<tr>
			<td class="head" nowrap="nowrap">
				<{$f.fname}>
			</td>
			<td class="<{cycle values='odd,even'}>" >
				<{if $smarty.get.action==confirm}>
					<{$data[0].data[$f.fid]}>
					<input type="hidden" name="<{$mydirname}>_field<{$f.fid}>" id="<{$mydirname}>_field<{$f.fid}>" value="<{if !$post_multi}><{$data[0].data[$f.fid]}><{/if}>" />
				<{else}>
					<input type="text" name="<{$mydirname}>_field<{$f.fid}>" id="<{$mydirname}>_field<{$f.fid}>" size="50" maxlength="255" value="<{if !$post_multi}><{$data[0].data[$f.fid]}><{/if}>" />
				<{/if}>
			</td>
		</tr>
		<{/if}>
	<{/foreach}>

<{if $formtag}>
	<tr>
		<td class="head" valign="top">
			<{$smarty.const._MD_FD_SUBMITTER}>
		</td>
		<td class="odd">
			<{$uname}>
		</td>
	</tr>

	<tr class="foot">
		<td>&nbsp;</td>
		<td>
			<input type="submit" name="<{if $data && !$post_multi}>edit<{else}>submit<{/if}>" class="button" value="<{$smarty.const._SUBMIT}>" />
			<{if $data && !$post_multi && ($isadmin || ($delperm && $data[0].uid==$uid))}>
				<input type="button" value="<{$smarty.const._DELETE}>" onclick='if(confirm("<{$smarty.const._MD_FD_EMBED_DATA_DEL_MSG}>")){document.postform.flatdata_deldata.value="1";submit();}' />
			<{/if}>
		</td>
	</tr>
</table>


<{$gticket}>
<input type="hidden" name="flatdata_deldata" value="" />
<{/if}>
<input type="hidden" name="flatdata_did" value="<{if !$post_multi}><{$data[0].did}><{/if}>" />
<input type="hidden" name="flatdata_fd_dir" value="<{$basedata.fd_dir}>" />
<input type="hidden" name="flatdata_embed_dir" value="<{$basedata.embed_dir}>" />
<input type="hidden" name="flatdata_item_field" value="<{$basedata.item_field}>" />
<input type="hidden" name="flatdata_item_id" value="<{$basedata.item_id}>" />
<input type="hidden" name="flatdata_filequery" value="<{$basedata.filequery}>" />

<{if $formtag}>
	</form>
</div>



<script type='text/javascript'>
<!--//
function flatdata_onoff<{$basedata.item_id}>( elmid ){
	var chk_elm = document.getElementById( elmid+'ONOFF<{$basedata.item_id}>' );
	var onoff_elm = document.getElementById( elmid+'<{$basedata.item_id}>' );
	if( chk_elm.checked ){
		onoff_elm.style.display = 'block';
	}else{
		onoff_elm.style.display = 'none';
	}
}
//-->
</script>
<{/if}>
